aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/[lang=lang]/sections/hero.svelte
blob: 8a874dc0831197e652e7d0f30b4ed1575739af6f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<script context="module" lang="ts">
	import type { SanityBlockArray } from "$lib/sanity/types/block-array";

	export type HeroModel = {
		title: string;
		content?: SanityBlockArray;
	};
</script>

<script lang="ts">
	import { PortableText } from "@portabletext/svelte";
	export let model: HeroModel;

	let visible = true;

	$: if (!model.title) {
		visible = false;
	} else {
		visible = true;
	}
</script>

{#if visible}
	<h1>{model.title}</h1>
	{#if model.content}
		<PortableText value={model.content} />
	{/if}
{/if}